package com.zh.jwt.common.exception;

import com.zh.jwt.common.enums.BizEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 自定义业务异常
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class BizException extends RuntimeException {
    /**
     * 错误码
     */
    private int code;
    /**
     * 错误信息
     */
    private String message;

    public BizException(BizEnum bizEnum) {
        this(bizEnum.getCode(), bizEnum.getMessage());
    }

    public BizException(int code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }
}